package net.ericaro.neogrex;


/** Callback "Sax" like interface for the Regexp parser.
 * 
 * @author eric
 *
 * @param <T>
 */
public interface RegExpReceiver<T> {


	
	/**  Called to finalize T. 
	 * 
	 * @param t
	 */
	public  T end(T t);
		
	/** Called to execute a sequence operation <code>v1 , v2</code>
	 * 
	 * @param v1
	 * @param v2
	 * @return
	 */
	public  T seq(T v1, T v2);

	/** called to execute a selection operation <code>v1 | v2</code>
	 * 
	 * @param v1
	 * @param v2
	 * @return
	 */
	public  T sel(T v1, T v2);

	
	/**call to build a T from a terminal element.
	 * 
	 * @param name
	 * @return
	 */
	public  T terminal(String name);

	/**
	 * Called to execute <code>v*</code> meaning an 0 or more times.
	 * @param v
	 * @return
	 */
	public  T star(T v);

	/**
	 * Called to execute <code>v+</code> meaning an 1 or more times.
	 * @param v
	 * @return
	 */
	public  T plus(T v);

	/** called to execute the <code>v?</code> meaning 0 or 1 time
	 * 
	 * @param v
	 * @return
	 */
	public  T opt(T v);

}